package com.hongxun.design.ui.ui_map_icon;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.hongxun.design.R;

/**
 * Created by zerdoor_pc on 2016/6/7.
 */
public class PointView extends RelativeLayout {
    public TextView title, icon;
    private Context mContext = null;
    View parentView;
    public PointView(Context context) {
        super(context);
        mContext = context;
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        parentView = inflater.inflate(R.layout.pointview_item, this, true);
        title = (TextView) findViewById(R.id.point_title);
        icon = (TextView) findViewById(R.id.point_icon);

    }

    public PointView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext = context;

    }




    public void setTitle(String name) {
        if (title!=null){
            title.setText(name);
        }
    }

    public void setTitleGone(int g){
        if (title!=null){
            title.setVisibility(g);
        }
    }
    public int getTitleGone(){
           return title.getVisibility();
    }


    public void setIcon(int image,String text) {
        if (icon!=null){
            icon.setBackgroundResource(image);
            icon.setText(text);
        }
    }
    public void setOnClick(OnClickListener listener){
        parentView.setOnClickListener(listener);
    }
}
